<%@ page language="java" pageEncoding="utf-8"%>
<%@ page import="bean.userbean,db.dbOperation"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
  <head>

    <html:base />
    
    <title>purchasing.jsp</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	
	-->
	<script  type="text/javascript">
	function abc(){
	return window.confirm("确定要删除用户吗?");
	}
	</script>
  </head>
  
  <body>
   <%@ include file="header.jsp"%>
     <% 
     	int pagenow = Integer.parseInt((String)request.getAttribute("pagenow"));
     	ArrayList list = (ArrayList)request.getAttribute("list");
     %>
     <table width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td width="120" valign="top" background="images/in_left_bg.gif"><%@ include file="left2.jsp"%></td>
    <td width="660" align="center" valign="top">
    <h2 align="center">用户信息列表</h2>
  <table width="640"  border="1" cellpadding="3" cellspacing="0" bordercolor="#CCCCCC">
  <tr bgcolor="#E1EEF8">
    <td>用户ID</td>
    <td>用户帐号</td>
    <td align="center">用户修改</td>
    <td align="center">用户删除</td>
   </tr>
 <%
	for(int i=0;i<list.size();i++){
	userbean ub=(userbean)list.get(i);
  %>
  <tr>
    <td><%=ub.getId() %></td>
    <td><%=ub.getUsername() %></td>
      <td align="center"><a href="updUser.jsp?id=<%=ub.getId() %>&username=<%=ub.getUsername() %>&password=<%=ub.getPassword() %>">修改</a></td>
    <td align="center"><a onclick="return abc();" href="userServlet?flag=deluser&id=<%=ub.getId() %>">删除</a></td>
   </tr>
   <%
 	}  
    %>
</table>
<div align="center">
<%
	if(pagenow!=1){
	out.print("<a href=userServlet?flag=page&pagenow="+1+">首 页</a>");
	out.print("<a href=userServlet?flag=page&pagenow="+(pagenow-1)+">上一页</a>");
	}
	String s_pagecount = (String)request.getAttribute("pagecount");
	int pagecount = Integer.parseInt(s_pagecount);
	
	for(int i=1;i<=pagecount;i++){
	out.print("<a href=userServlet?flag=page&pagenow="+i+">["+i+"]</a>");
	}
	if(pagenow!=pagecount){
	out.print("<a href=userServlet?flag=page&pagenow="+(pagenow+1)+">下一页</a>");
	out.print("<a href=userServlet?flag=page&pagenow="+pagecount+">末  页</a>");
	}
 %>
</div>
</td>
</tr>
</table>
    
<%@ include file="footer.jsp"%>
  </body>
</html:html>
